const mongoose = require('mongoose');

module.exports.getAll3 = async () =>{
    return await mongoose.model('typesModel').find();
}
module.exports.deletOne3 = async function (typesId){
    const data = await mongoose.model('typesModel').deleteOne(typesId);
    return data;
    
}
module.exports.addOne3 = async types =>{
    const data = await mongoose.model("typesModel").create(types);
    return data;
}
//修改  1.获取
module.exports.getOne3 = async _Id =>{
    return await mongoose.model('typesModel').find(_Id);
}
//修改 2.确认修改
module.exports.updateOne3 =async ({_id,type_name}) =>{
    return await mongoose.model('typesModel').updateOne({_id},{type_name});
    
}

//goods搜寻
module.exports.typessearch =async ({searchType,searchValue}) =>{
    return await mongoose.model('typesModel').find(  {name: {$regex: searchValue, $options: '$i'}});

    
}